<?php
class SqlProcedure {
    var $row;
    var $DB_type;
    var $DB;
    function SqlProcedure($dsn){
        $this->DB = NewADOConnection($dsn);
        if ( !$this->DB ) die("Connection error - $dsn");
        $this->DB->SetFetchMode(ADODB_FETCH_ASSOC);
    }
    function Execute($query='select now()'){
        $this->row  = $this->DB->Execute($query) or die ($this->DB->ErrorMsg());
    }
    function FetchAll($query){
        $this->Execute($query);
        while(!$this->row->EOF){
            $temp[] = $this->row->fields;
            $this->row->MoveNext();
        }
        return $temp;
    }
 
    function FetchAllArray($query,$key,$value) {
        $this->Execute($query);
        while(!$this->row->EOF){
            $temp[$this->row->fields[$key]] = $this->row->fields[$value];
            $this->row->MoveNext();
        }
        return $temp;
    }
    function qstr($string) {
        return $this->DB->qstr($string,get_magic_quotes_gpc());
    }
}
?>